热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Jquery:选择具有特定来源的图像?-Jquery:Selectingimageswithaspecificsource?

Ivelookedhighandlowthroughthedocsandinternet,anddamnifIcantfigurethisout.我通过文档和互

I've looked high and low through the docs and internet, and damn if I can't figure this out.

我通过文档和互联网看起来很高低,如果我无法弄清楚这一点,该死的。

I would like to use jquery to select all images with a specific source and apply a tool tip to them. I have the tooltip working fine when I'm finding the target with classes, but I figured it would be a bit more efficient and avoid adding unneeded classes when I should be able to select all the images with a known img source. The code that I think should work is:

我想使用jquery选择具有特定源的所有图像并将工具提示应用于它们。当我找到带有类的目标时,我的工具提示工作正常,但我认为当我应该能够选择具有已知img源的所有图像时,它会更有效并避免添加不需要的类。我认为应该运行的代码是:

$("img[src*='phone']")

The image tag in the source is:

源中的图像标记是:


Using Firebug's Dom inspector, the img element has the following source:

使用Firebug的Dom检查器,img元素具有以下来源:

"http://www.deleted.com/v2/images/icons/Phone-32x32.png"

I've dicked around with various waves of selecting it, and it's beyound me. Any help would be greatly appreciated.

我已经四处乱窜,选择它的各种浪潮,这让我感到很震惊。任何帮助将不胜感激。

2 个解决方案

#1


Ugh... The issue was capitalization! Changed it to:

呃......问题是资本化!将其更改为:

$("img[src*='Phone']")

Now it works fine. Please ignore my stupidity.

现在它工作正常。请忽略我的愚蠢。

#2


If you'd like a case-insensitive selector this question might be helpful:

如果你想要一个不区分大小写的选择器,这个问题可能会有所帮助:

Is there a case insensitive jQuery :contains selector?

是否有一个不区分大小写的jQuery:包含选择器?


推荐阅读
author-avatar
手机用户2602881053
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有